package aerys.minko.scene.stardust {
	import aerys.minko.scene.group.IGroup3D;
	import aerys.minko.scene.stardust.ParticleObject3D;
	import aerys.minko.scene.IScene3D;
	import flash.utils.Dictionary;
	import idv.cjcat.stardust.common.handlers.ParticleHandler;
	import idv.cjcat.stardust.common.particles.Particle;
	import idv.cjcat.stardust.threeD.particles.Particle3D;
	
	public class MinkoParticleHandler extends ParticleHandler {
		
		public var parent:IGroup3D;
		
		public function MinkoParticleHandler() {
			
		}
		
		override public function particleAdded(particle:Particle):void {
			particle.target = 
				parent.addChild(
					new ParticleObject3D(Particle3D(particle), 
					IScene3D(particle.dictionary[MinkoParticleInitializer]))
				);
		}
		
		override public function particleRemoved(particle:Particle):void {
			parent.removeChild(ParticleObject3D(particle.target));
		}
	}
}